<template>
  <div class="author-page">
    <!-- 标题部分 -->
    <div class="title-section">
      <div class="title-container animate__animated animate__fadeIn">
        <h1 class="gradient-text">作者介绍</h1>
        <div class="subtitle-wrapper">
          <span class="subtitle-item">国护人</span>
          <span class="dot">·</span>
          <span class="subtitle-item">程序员</span>
          <span class="dot">·</span>
          <span class="subtitle-item">追梦者</span>
        </div>
      </div>
    </div>

    <div class="section-container">
      <!-- 基本信息卡片 -->
      <div class="author-card glass-effect animate__animated animate__fadeInUp">
        <div class="author-info">
          <div class="author-avatar hover-float">
            <el-image
              src="https://img.zcool.cn/community/01639e5d8b1927a8012060be0f0ddb.jpg"
              fit="cover">
            </el-image>
          </div>
          <div class="author-details">
            <h2>安嘉童</h2>
            <div class="info-grid">
              <div class="info-item">
                <i class="el-icon-user"></i>
                <span>性别：男</span>
              </div>
              <div class="info-item">
                <i class="el-icon-date"></i>
                <span>年龄：{{ calculateAge('2002-11-08') }}岁</span>
              </div>
              <div class="info-item">
                <i class="el-icon-school"></i>
                <span>专业：人工智能</span>
              </div>
              <div class="info-item">
                <i class="el-icon-reading"></i>
                <span>年级：2021级</span>
              </div>
              <div class="info-item">
                <i class="el-icon-office-building"></i>
                <span>书院：启贤住宿书院</span>
              </div>
              <div class="info-item">
                <i class="el-icon-medal"></i>
                <span>特长：编程</span>
              </div>
              <div class="info-item">
                <i class="el-icon-star-on"></i>
                <span>爱好：编程</span>
              </div>
            </div>
          </div>
        </div>
      </div>

      <!-- 国护经历 -->
      <div class="experience-section glass-effect animate__animated animate__fadeInUp animate__delay-1s">
        <h2 class="section-title gradient-text">国护经历</h2>
        <el-timeline>
          <el-timeline-item
            v-for="(experience, index) in experiences"
            :key="index"
            :timestamp="experience.time"
            placement="top">
            <div class="timeline-content hover-card">
              <h3>{{ experience.title }}</h3>
              <p>{{ experience.description }}</p>
              <el-image
                v-if="experience.image"
                :src="experience.image"
                fit="cover"
                class="timeline-image">
              </el-image>
            </div>
          </el-timeline-item>
        </el-timeline>
      </div>

      <!-- 作者寄语 -->
      <div class="message-section glass-effect animate__animated animate__fadeInUp animate__delay-2s">
        <h2 class="section-title gradient-text">作者寄语</h2>
        <div class="message-content hover-card">
          <i class="el-icon-chat-dot-square message-icon"></i>
          <blockquote>
            "作为一名国护人，我深感自豪。在这里，我不仅学会了严谨的作风和精益求精的态度，
            更收获了珍贵的友情和难忘的回忆。希望通过这个项目，能让更多人了解和加入国旗护卫队，
            传承这份荣耀。"
          </blockquote>
        </div>
      </div>

      <!-- 联系方式 -->
      <div class="contact-section glass-effect animate__animated animate__fadeInUp animate__delay-3s">
        <h2 class="section-title gradient-text">联系方式</h2>
        <div class="contact-grid">
          <div class="contact-item hover-card">
            <i class="el-icon-message"></i>
            <span>邮箱：example@sias.edu.cn</span>
          </div>
          <div class="contact-item hover-card">
            <i class="el-icon-mobile-phone"></i>
            <span>电话：123-4567-8900</span>
          </div>
          <div class="contact-item hover-card">
            <i class="el-icon-chat-dot-round"></i>
            <span>微信：example_wechat</span>
          </div>
          <div class="contact-item hover-card">
            <i class="el-icon-chat-line-round"></i>
            <span>QQ：123456789</span>
          </div>
        </div>
      </div>

      <!-- 特别鸣谢 -->
      <div class="thanks-section glass-effect animate__animated animate__fadeInUp animate__delay-4s">
        <h2 class="section-title gradient-text">特别鸣谢</h2>
        <div class="thanks-content">
          <p>感谢以下国护队员在项目开发过程中提供的帮助与支持：</p>
          <div class="thanks-list">
            <span v-for="(member, index) in thanksList" :key="index" class="member-tag hover-float">
              {{ member }}
            </span>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'AuthorPage',
  data() {
    return {
      experiences: [
        {
          time: '2022年9月',
          title: '加入国旗护卫队',
          description: '经过严格选拔，成功加入国旗护卫队',
          image: 'https://img.zcool.cn/community/01e0bc5d8b1927a8012060be78795f.jpg'
        },
        {
          time: '2023年5月',
          title: '担任技术组长',
          description: '负责队伍技术工作，开发国旗护卫队管理系统'
        }
      ],
      thanksList: [
        '张三', '李四', '王五', '赵六'
      ]
    }
  },
  methods: {
    calculateAge(birthDate) {
      const birth = new Date(birthDate)
      const today = new Date()
      let age = today.getFullYear() - birth.getFullYear()
      const monthDiff = today.getMonth() - birth.getMonth()
      
      if (monthDiff < 0 || (monthDiff === 0 && today.getDate() < birth.getDate())) {
        age--
      }
      
      return age
    }
  }
}
</script>

<style scoped>
.author-page {
  min-height: calc(100vh - var(--header-height));
}

.section-container {
  max-width: 1200px;
  margin: 40px auto 60px;
  padding: 0 20px;
  position: relative;
  z-index: 2;
}

/* 基本信息卡片 */
.author-card {
  padding: 30px;
  border-radius: var(--radius-md);
  margin-bottom: 30px;
}

.author-info {
  display: flex;
  gap: 40px;
  align-items: center;
}

.author-avatar {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  overflow: hidden;
  border: 4px solid rgba(99, 102, 241, 0.1);
}

.author-avatar .el-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.author-details {
  flex: 1;
}

.author-details h2 {
  font-size: 2em;
  margin-bottom: 20px;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
}

.info-item {
  display: flex;
  align-items: center;
  gap: 10px;
}

.info-item i {
  font-size: 20px;
  color: #6366f1;
}

/* 国护经历 */
.experience-section {
  padding: 30px;
  border-radius: var(--radius-md);
  margin-bottom: 30px;
}

.timeline-content {
  padding: 20px;
  background: rgba(255, 255, 255, 0.5);
  border-radius: var(--radius-md);
}

.timeline-image {
  width: 100%;
  max-height: 200px;
  border-radius: var(--radius-md);
  margin-top: 15px;
}

/* 作者寄语 */
.message-section {
  padding: 30px;
  border-radius: var(--radius-md);
  margin-bottom: 30px;
}

.message-content {
  position: relative;
  padding: 30px;
  background: rgba(255, 255, 255, 0.5);
  border-radius: var(--radius-md);
  margin-top: 30px;
}

.message-icon {
  font-size: 48px;
  position: absolute;
  top: -24px;
  left: 30px;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

blockquote {
  margin: 0;
  padding-left: 20px;
  border-left: 4px solid #6366f1;
  font-style: italic;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* 联系方式 */
.contact-section {
  padding: 30px;
  border-radius: var(--radius-md);
  margin-bottom: 30px;
}

.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-top: 30px;
}

.contact-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 15px;
  background: rgba(255, 255, 255, 0.5);
  border-radius: var(--radius-md);
}

.contact-item i {
  font-size: 24px;
  color: #6366f1;
}

/* 特别鸣谢 */
.thanks-section {
  padding: 30px;
  border-radius: var(--radius-md);
}

.thanks-content {
  margin-top: 30px;
}

.thanks-list {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  margin-top: 20px;
}

.member-tag {
  padding: 8px 16px;
  background: rgba(99, 102, 241, 0.1);
  border-radius: 20px;
  color: #6366f1;
  font-size: 14px;
}

/* 通用样式 */
.glass-effect {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(99, 102, 241, 0.1);
}

.section-title {
  font-size: 1.5em;
  margin-bottom: 20px;
}

/* 响应式调整 */
@media (max-width: 768px) {
  .section-container {
    margin-top: 20px;
    padding: 0 15px;
  }

  .author-info {
    flex-direction: column;
    text-align: center;
  }

  .author-avatar {
    width: 150px;
    height: 150px;
    margin: 0 auto;
  }

  .info-grid {
    grid-template-columns: 1fr;
  }
}

/* 网格背景 */
.grid-pattern {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: 
    linear-gradient(rgba(99, 102, 241, 0.1) 1px, transparent 1px),
    linear-gradient(90deg, rgba(99, 102, 241, 0.1) 1px, transparent 1px);
  background-size: 20px 20px;
  opacity: 0.3;
  animation: moveGrid 15s linear infinite;
}

/* 光晕效果 */
.glow-effect {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
}

.glow-1 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle at center,
    rgba(99, 102, 241, 0.15),
    rgba(139, 92, 246, 0.1),
    transparent 70%
  );
  top: -200px;
  right: -100px;
  animation: pulse 10s ease-in-out infinite alternate;
}

.glow-2 {
  width: 300px;
  height: 300px;
  background: radial-gradient(circle at center,
    rgba(59, 130, 246, 0.15),
    rgba(45, 212, 191, 0.1),
    transparent 70%
  );
  bottom: -150px;
  left: -50px;
  animation: pulse 8s ease-in-out infinite alternate-reverse;
}

/* 装饰元素 */
.decorative-elements {
  position: absolute;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.circle {
  position: absolute;
  border: 2px solid rgba(99, 102, 241, 0.1);
  border-radius: 50%;
}

.circle:nth-child(1) {
  width: 60px;
  height: 60px;
  top: 20%;
  right: 15%;
  animation: rotate 20s linear infinite;
}

.circle:nth-child(2) {
  width: 40px;
  height: 40px;
  bottom: 30%;
  left: 10%;
  animation: rotate 15s linear infinite reverse;
}

.circle:nth-child(3) {
  width: 80px;
  height: 80px;
  top: 40%;
  left: 30%;
  animation: rotate 25s linear infinite;
}

.dot {
  position: absolute;
  width: 4px;
  height: 4px;
  background: rgba(99, 102, 241, 0.3);
  border-radius: 50%;
}

.dot:nth-child(4) {
  top: 25%;
  left: 20%;
  animation: float 4s ease-in-out infinite;
}

.dot:nth-child(5) {
  top: 60%;
  right: 25%;
  animation: float 6s ease-in-out infinite;
}

.dot:nth-child(6) {
  bottom: 20%;
  left: 40%;
  animation: float 5s ease-in-out infinite;
}

/* 动画关键帧 */
@keyframes moveGrid {
  0% {
    transform: translateX(-20px) translateY(-20px);
  }
  100% {
    transform: translateX(0) translateY(0);
  }
}

@keyframes pulse {
  0% {
    transform: scale(1);
    opacity: 0.5;
  }
  100% {
    transform: scale(1.2);
    opacity: 0.3;
  }
}

@keyframes rotate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes float {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

/* 确保内容在背景之上 */
.header-content {
  position: relative;
  z-index: 2;
  width: 100%;
  padding: 0 20px;
}

.title-container {
  animation: fadeInUp 1s ease-out;
}

.title-container h1 {
  font-size: 2.8em;
  margin-bottom: 20px;
  font-weight: 700;
  background: linear-gradient(45deg, #6366f1, #8b5cf6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 2px 4px rgba(99, 102, 241, 0.1);
}

.subtitle-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
}

.subtitle-item {
  font-size: 1.3em;
  color: var(--text-secondary);
  font-weight: 500;
  letter-spacing: 1px;
  padding: 5px 15px;
  background: rgba(99, 102, 241, 0.05);
  border-radius: 20px;
  transition: all 0.3s ease;
}

.subtitle-item:hover {
  transform: translateY(-2px);
  background: rgba(99, 102, 241, 0.1);
  color: #6366f1;
}

.dot {
  color: #6366f1;
  font-weight: 700;
  opacity: 0.5;
}

/* 动画效果 */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 响应式调整 */
@media (max-width: 768px) {
  .title-container h1 {
    font-size: 2.2em;
  }
  
  .subtitle-item {
    font-size: 1.1em;
    padding: 4px 12px;
  }
  
  .subtitle-wrapper {
    gap: 8px;
  }
}

/* 悬浮效果 */
.hover-card {
  transition: all 0.3s ease;
}

.hover-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 20px rgba(99, 102, 241, 0.1);
}

.hover-float {
  animation: float 3s ease-in-out infinite;
}

.title-section {
  height: 200px;
  display: flex;
  justify-content: center;
  align-items: center;
  background: linear-gradient(135deg, #f6f7ff 0%, #f0f3ff 100%);
  margin-bottom: 0;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.title-container {
  text-align: center;
  z-index: 2;
}

.title-container h1 {
  font-size: 2.8em;
  margin-bottom: 20px;
  font-weight: 700;
  background: linear-gradient(45deg, #6366f1, #8b5cf6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 2px 4px rgba(99, 102, 241, 0.1);
}

.subtitle-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
}

.subtitle-item {
  font-size: 1.3em;
  color: var(--text-secondary);
  font-weight: 500;
  letter-spacing: 1px;
  padding: 5px 15px;
  background: rgba(99, 102, 241, 0.05);
  border-radius: 20px;
  transition: all 0.3s ease;
}

.subtitle-item:hover {
  transform: translateY(-2px);
  background: rgba(99, 102, 241, 0.1);
  color: #6366f1;
}

.dot {
  color: #6366f1;
  font-weight: 700;
  opacity: 0.5;
}

/* 响应式调整 */
@media (max-width: 768px) {
  .title-section {
    height: 160px;
    padding: 0 15px;
  }

  .title-container h1 {
    font-size: 2.2em;
  }
  
  .subtitle-item {
    font-size: 1.1em;
    padding: 4px 12px;
  }
  
  .subtitle-wrapper {
    gap: 8px;
  }
}
</style> 